package com.ruitu.health_2.mvp.model;

import com.ruitu.arad.api.RxUtil;
import com.ruitu.arad.base.BaseModel;
import com.ruitu.health_2.dao.http.APIRetrofit;
import com.ruitu.router_module.bean.BaseResult2;
import com.ruitu.router_module.bean.PageModel2;
import com.ruitu.router_module.bean.article.Article;
import com.ruitu.router_module.bean.home.AdvertContent;
import com.ruitu.router_module.bean.home.ReadPartie;
import com.ruitu.router_module.bean.product.Activity;
import com.ruitu.router_module.bean.product.Book;
import com.ruitu.router_module.bean.product.ProHome;
import com.ruitu.router_module.bean.product.Video;

import io.reactivex.Observable;

public class CommonModel {

    public static class ComProListM extends BaseModel {

        // reqMallProListByTab
        public Observable<BaseResult2<PageModel2<AdvertContent<ProHome>>>> reqProListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqMallProListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<ProHome>>>>subIoObMain());
        }
    }

    public static class ComReadListM extends BaseModel {

        public Observable<BaseResult2<PageModel2<AdvertContent<ReadPartie>>>> reqReadListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqReadListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<ReadPartie>>>>subIoObMain());
        }
    }

    public static class ComBookListM extends BaseModel {

        public Observable<BaseResult2<PageModel2<AdvertContent<Book>>>> reqBookListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqBookListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<Book>>>>subIoObMain());
        }
    }

    public static class ComArticleListM extends BaseModel {

        public Observable<BaseResult2<PageModel2<AdvertContent<Article>>>> reqArticleListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqArticleListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<Article>>>>subIoObMain());
        }
    }

    public static class ComVideoListM extends BaseModel {

        public Observable<BaseResult2<PageModel2<AdvertContent<Video>>>> reqVideoListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqVideoListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<Video>>>>subIoObMain());
        }
    }

    public static class ComActivityListM extends BaseModel {

        public Observable<BaseResult2<PageModel2<AdvertContent<Activity>>>> reqActivityListByPos(String posId, int size, int num) {
            return APIRetrofit.getDefault()
                    .reqActivityListByTab(posId, size, num)
                    .compose(RxUtil.<BaseResult2<PageModel2<AdvertContent<Activity>>>>subIoObMain());
        }
    }
}
